Here is my scenario: |
Re: Help with setting attribute in all modules
Try the following script - may need some further customisations here and there to suit your specific needs but should do it.
Module m
Object o
Item i
int x
string itemType
string modName, fullModName
string attrDefName1 = "Reuse"
string attrDefName2 = "Test Method"
string testMethod = "D"
for i in current Project do
{
itemType = type i
if( itemType == "Formal")
{
fullModName = fullName(i)
modName = name(i)
m = edit(fullModName,false)
x = 0
if (m == null) { //problem detected with opening the module
print modName ":\t ERROR - could not open module\n"
continue
}
current = m
if ((exists attribute attrDefName1) && (exists attribute attrDefName2)) {
for o in current do {
if ((o.attrDefName1"" == "New")||(o.attrDefName1"" == "Mod")) {
o.attrDefName2 = testMethod
x++ //count each change being made
save(m)
}
}
}
else {
print modName ":\t Does not contain one or both attributes\n"
close(m)
continue
}
close(m)
print modName ":\t" x " changes applied\n"
}
}
Paul Miller
|
Re: Help with setting attribute in all modules
Thanks Paul...
Module m
Object o
Item i
int x
string itemType
string modName, fullModName
string attrDefName1 = "Reuse"
string attrDefName2 = "CSCI Test Method"
string attrDefName3 = "Requirement"
string testMethod = "D"
for i in current Folder do
{
itemType = type i
if( itemType == "Formal")
{
fullModName = fullName(i)
modName = name(i)
m = edit(fullModName,false)
x = 0
if (m == null) { //problem detected with opening the module
print modName ":\t ERROR - could not open module\n"
continue
}
current = m
if ((exists attribute attrDefName1) && (exists attribute attrDefName2)) {
for o in current do {
if ((o.attrDefName1"" == "New")||(o.attrDefName1"" == "Modified") && (o.attrDefName3"" == "True")) {
o.attrDefName2 = testMethod
x++ //count each change being made
save(m)
}
}
}
else {
print modName ":\t Does not contain one or both attributes\n"
close(m)
continue
}
close(m)
print modName ":\t" x " changes applied\n"
}
}
|
Re: Help with setting attribute in all modules SystemAdmin - Sun May 15 05:40:29 EDT 2011
Try the following script - may need some further customisations here and there to suit your specific needs but should do it.
Module m
Object o
Item i
int x
string itemType
string modName, fullModName
string attrDefName1 = "Reuse"
string attrDefName2 = "Test Method"
string testMethod = "D"
for i in current Project do
{
itemType = type i
if( itemType == "Formal")
{
fullModName = fullName(i)
modName = name(i)
m = edit(fullModName,false)
x = 0
if (m == null) { //problem detected with opening the module
print modName ":\t ERROR - could not open module\n"
continue
}
current = m
if ((exists attribute attrDefName1) && (exists attribute attrDefName2)) {
for o in current do {
if ((o.attrDefName1"" == "New")||(o.attrDefName1"" == "Mod")) {
o.attrDefName2 = testMethod
x++ //count each change being made
save(m)
}
}
}
else {
print modName ":\t Does not contain one or both attributes\n"
close(m)
continue
}
close(m)
print modName ":\t" x " changes applied\n"
}
}
Paul Miller
Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: Help with setting attribute in all modules vppatel - Mon May 16 09:36:43 EDT 2011
Thanks Paul...
Module m
Object o
Item i
int x
string itemType
string modName, fullModName
string attrDefName1 = "Reuse"
string attrDefName2 = "CSCI Test Method"
string attrDefName3 = "Requirement"
string testMethod = "D"
for i in current Folder do
{
itemType = type i
if( itemType == "Formal")
{
fullModName = fullName(i)
modName = name(i)
m = edit(fullModName,false)
x = 0
if (m == null) { //problem detected with opening the module
print modName ":\t ERROR - could not open module\n"
continue
}
current = m
if ((exists attribute attrDefName1) && (exists attribute attrDefName2)) {
for o in current do {
if ((o.attrDefName1"" == "New")||(o.attrDefName1"" == "Modified") && (o.attrDefName3"" == "True")) {
o.attrDefName2 = testMethod
x++ //count each change being made
save(m)
}
}
}
else {
print modName ":\t Does not contain one or both attributes\n"
close(m)
continue
}
close(m)
print modName ":\t" x " changes applied\n"
}
}
Mathias, will look into your inputs. Thanks |